package com.zhuangjie.rider.controller;

import com.zhaungjie.base.conduit.R;
import com.zhuangjie.base.constant.ModuleSecurityNames;
import com.zhuangjie.rider.dto.RiderEvaluateDTO;
import com.zhuangjie.rider.service.RiderEvaluateService;
import com.zhuangjie.security.annotations.OnlySystemCall;
import com.zhuangjie.security.annotations.PublicAPI;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 骑手评价 前端控制器
 * </p>
 *
 * @author zhuangjie
 * @since 2024-04-25
 */
@RestController
@RequestMapping("/rider-evaluate")
public class RiderEvaluateController {
    @Autowired
    private RiderEvaluateService riderEvaluateService;
    @ApiOperation("子评价-评价提交到骑手")
    @PublicAPI(modules = {ModuleSecurityNames.USER})
    @PostMapping("/submit")
    @OnlySystemCall
    public R submitRiderEvaluate(@Valid @RequestBody RiderEvaluateDTO riderEvaluateDTO) {
        return R.capture(()->riderEvaluateService.submitEvaluate(riderEvaluateDTO));
    }
}
